//
//  MeMyPostListCell.m
//  youthNote
//
//  Created by huangrensheng on 16/7/19.
//  Copyright © 2016年 laber. All rights reserved.
//

#import "MeMyPostListCell.h"

@interface MeMyPostListCell()

@property (nonatomic, strong) UILabel *postTitle;//发帖主题

//@property (nonatomic, strong) UILabel *postAuthor;//发帖人

@property (nonatomic, strong) UILabel *sendTime;//发帖时间

@property (nonatomic, strong) UILabel *replyCount;//回复

@property (nonatomic, strong) UIImageView *rightArrow;
@end

@implementation MeMyPostListCell

- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if ([super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        [self initChildViews];
        [self makeConstraints];
    }
    return self;
}

- (void)initChildViews{
    self.postTitle = [[UILabel alloc] initWithFont:[UIFont systemFontOfSize:FONT_LITTLE_MIDDLE] TextColor:BLACK_COLOR Text:@"主题"];
    [self.contentView addSubview:self.postTitle];
    
//    self.postAuthor = [[UILabel alloc] initWithFont:[UIFont systemFontOfSize:FONT_SMALL] TextColor:BLACK_LOW_COLOR Text:@"Laber"];
//    [self.contentView addSubview:self.postAuthor];
    
    self.sendTime = [[UILabel alloc] initWithFont:[UIFont systemFontOfSize:FONT_SMALL] TextColor:DARK_GRAY_COLOR Text:@"2016-07-19"];
    self.sendTime.textAlignment = NSTextAlignmentRight;
    [self.contentView addSubview:self.sendTime];
    
    self.replyCount = [[UILabel alloc] initWithFont:[UIFont systemFontOfSize:FONT_SMALL] TextColor:DARK_GRAY_COLOR Text:@"回复:100"];
    [self.contentView addSubview:self.replyCount];
    
    self.rightArrow = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"right_arrow"]];
    [self.contentView addSubview:self.rightArrow];
}

- (void)makeConstraints{
    __weak typeof(self) weakSelf = self;
    [self.rightArrow mas_makeConstraints:^(MASConstraintMaker *make) {
        make.width.equalTo(@10);
        make.centerY.equalTo(weakSelf.contentView.mas_centerY);
        make.trailing.equalTo(weakSelf.contentView.mas_trailing).equalTo(inset(-10));
    }];
    
    [self.postTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.and.top.equalTo(weakSelf.contentView).equalTo(@10);
        make.trailing.equalTo(weakSelf.rightArrow.mas_leading).equalTo(inset(-10));
    }];
    
    [self.replyCount mas_makeConstraints:^(MASConstraintMaker *make) {
        make.leading.equalTo(weakSelf.postTitle.mas_leading);
        make.bottom.equalTo(weakSelf.contentView.mas_bottom).equalTo(inset(-10));
        make.trailing.equalTo(weakSelf.sendTime.mas_leading).equalTo(inset(-10));
    }];
    
    [self.sendTime mas_makeConstraints:^(MASConstraintMaker *make) {
        make.trailing.equalTo(weakSelf.postTitle.mas_trailing);
        make.top.equalTo(weakSelf.replyCount.mas_top);
        make.width.equalTo(@100);
    }];
}

@end
